﻿// Author: Hristo Hristov
// Date: 06.10.11
// Revision 1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BEPUphysicsDrawer.Models;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace NOVA.Utilities
{
    /// <summary>
    /// Renders the collision meshes of the scene objects by 
    /// using a similar implementation of the BruteModelDrawer
    /// of the BEPUphysics debug drawer.
    /// </summary>
    public class CollisionMeshRenderer : BruteModelDrawer
    {
        public Color Color { get; set; }

        public CollisionMeshRenderer(Game game)
            : base(game)
        {
            
        }

        /// <summary>
        /// Sets the collision mesh color by changing all internal
        /// textures of the ModelDrawer.
        /// </summary>
        public void SetColor(Color newColor)
        {
            for (int i = 0; i < textures.Length; i++)
            {
                textures[i].SetData<Color>(new Color[]{newColor});
            }

            Color = newColor;
        }
    }
}
